/* This file last updated: 11/12/11
Dataverse: http://dvn.iq.harvard.edu/dvn/dv/guiltyminds

Replication Code for:
Francis X. Shen, Morris B. Hoffman, Owen D. Jones, Joshua D. Greene, and Ren� Marois
Sorting Guilty Minds, 86 N.Y.U. Law Review 1306 (2011)
http://ssrn.com/abstract=1746107

This Stata code can be used to replicate the statistical findings reported in the Article.
The figures in the Article rely on the same data, but were generated separately using the data visualization program Tableau.

The notes below specify which Stata .dta file should be employed for each piece of the reported analysis.

Please direct any questions about this data to: Francis Shen, fxshen@post.harvard.edu
 */ 

* Note: The ResponseID variable is a subject-specific identifier, which can be used to link the demographic file with other datasets in the study
 
** Data and code to generate the statistics in footnote 77
* use: ShenEtAl_2011_HarmRatingByTheme.dta

tabstat mean_harmrating, by (harmcategory)
reg  mean_harmrating lowharm mediumharm  highharm, nocons
test lowharm = mediumharm
test mediumharm = highharm

** TABLE 4 & TABLE 5: Data and code to generate Table 4 and Table 5
* use: ShenEtAl_2011_SubjectDemographics.dta

tabstat   QD_1, by(experiment) s(count) /*This gives the subject N by experiment*/

table  QD_9
/* Key
1: Less than High School
2: High School / GED
3: Some College
4: 2-year College Degree
5: 4-year College Degree
6: Master's Degree
7: Doctoral Degree
8: Professional Degree
--> Note that for the table we collapsed the final 3 categories into "Graduate Degree"
--> See notes in Article for source of U.S. census data
*/

table QD_11
/* Key
1: Below $20,000
2: $20,000 - $39,999
3: $40,000 - $59,999
4: $60,000 - $79,999
5: $80,000 - $99,999
6: $100,000 or more
*/

table  QD_7
/* Key: Gender
1: Male
2: Female
*/

table QD_6

table QD_8_5 if numraces==1
/* Key: Race
QD_8_1: American Indian
QD_8_2: Asian
QD_8_3: Black or African American
QD_8_4: Hispanic
QD_8_5: White
QD_8_6: Other
--> The Table reports the number of white (non-mixed-race) subjects and the number of non-white subjects
*/

table QD_5
/* Key: Jury Member in Criminal Case
1: Yes
2: No
*/

** FIGURE 1 & FIGURE 2: Data used to generate Figure 1 & Figure 2
* use: ShenEtAl_2011_Experiment1-PunishNoInstructions.dta

tabstat punish if p==1, by(theme)
tabstat punish if k==1, by(theme)
tabstat punish if r==1, by(theme)
tabstat punish if n==1, by(theme)
tabstat punish if b==1, by(theme)

* Note: see appendix code for accompanying statistical analysis

* FIGURE 3: Data used to generate Figure 3

* First Row: The top row of this figure replicates Figure 2 (see above_

* Second Row: use: ShenEtAl_2011_Experiment2-PunishDefinitionsOnce.dta
tabstat punish if p==1, by(theme)
tabstat punish if k==1, by(theme)
tabstat punish if r==1, by(theme)
tabstat punish if n==1, by(theme)
tabstat punish if b==1, by(theme)

* Third Row: use: ShenEtAl_2011_Experiment3-PunishDefinitionsContinuous.dta
tabstat punish if p==1, by(theme)
tabstat punish if k==1, by(theme)
tabstat punish if r==1, by(theme)
tabstat punish if n==1, by(theme)
tabstat punish if b==1, by(theme)

* Fourt Row: use: ShenEtAl_2011_Experiment5-PunishAfterSorting.dta
tabstat punish if p==1, by(theme)
tabstat punish if k==1, by(theme)
tabstat punish if r==1, by(theme)
tabstat punish if n==1, by(theme)
tabstat punish if b==1, by(theme)


** Table 6: Sorting
* use: ShenEtAl_2011_Experiment4-Sorting.dta
table answer if p==1
table answer if k==1
table answer if r==1
table answer if n==1
table answer if b==1

* Logit regression: Dep var is correct (1) / not-correct (0)
logit correct p k r n b, noconstant cluster(ResponseID)
test p = 0
test p = k
test k = r
test r = n
test n = b
test n = k

***** APPENDIX *****

* Experiment 1
* use: ShenEtAl_2011_Experiment1-PunishNoInstructions.dta

* Model discussed in footnote 120: Ordinal logit model with additional covariates
ologit punish p k r n median_harmrating white male age crimevictim conservative education, cluster(ResponseID)
test p = k
test k = r
test r = n
test n = b

* Model discussed in footnote 121
ologit punish p k r n i.theme, cluster(ResponseID)
test k = r

* Testing differences in standardized punishment ratings (z_punish) by mental state
reg z_punish p k r n b, nocons cluster(ResponseID)
test p = k
test k = r
test r = n
test n = b

* Table A1: Theme-by-theme testing of K / R differences
* Note: use the ShenEtAl_2011_HarmRatingByTheme.dta file in order to align original theme number and themes sorted by harm rating (as presented in the Appendix Tables and in the Figures)

* Data for the means reported in the table:
tabstat  punish if  k == 1, by(theme) s(mean)
tabstat  punish if  r == 1, by(theme) s(mean)

foreach x in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 {
reg z_punish p k r n if theme==`x', cluster(ResponseID)
test k = r
}

* Experiment 2
* use: ShenEtAl_2011_Experiment2-PunishDefinitionsOnce.dta

* Testing differences in standardized punishment ratings (z_punish) by mental state
reg z_punish p k r n b, nocons cluster(ResponseID)
test p = k
test k = r
test r = n
test n = b

* Table A2: Theme-by-theme testing of K / R differences
* Note: use the ShenEtAl_2011_HarmRatingByTheme.dta file in order to align original theme number and themes sorted by harm rating (as presented in the Appendix Tables and in the Figures)

* Data for the means reported in the table:
tabstat  punish if  k == 1, by(theme) s(mean)
tabstat  punish if  r == 1, by(theme) s(mean)

foreach x in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 {
reg z_punish p k r n if theme==`x', cluster(ResponseID)
test k = r
}

* Experiment 3
* Use: ShenEtAl_2011_Experiment3-PunishDefinitionsContinuous.dta

* Testing differences in standardized punishment ratings (z_punish) by mental state
reg z_punish p k r n b, nocons cluster(ResponseID)
test p = k
test k = r
test r = n
test n = b

* Table A3: Theme-by-theme testing of K / R differences
* Note: use the ShenEtAl_2011_HarmRatingByTheme.dta file in order to align original theme number and themes sorted by harm rating (as presented in the Appendix Tables and in the Figures)

* Data for the means reported in the table:
tabstat  punish if  k == 1, by(theme) s(mean)
tabstat  punish if  r == 1, by(theme) s(mean)

foreach x in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 {
reg z_punish p k r n if theme==`x', cluster(ResponseID)
test k = r
}

* Experiment 4
* use: ShenEtAl_2011_Experiment4-Sorting.dta

logit correct k if k==1 | r==1 ,  cluster(ResponseID)
test k = 0

logit correct r if k==1 | r==1 ,  cluster(ResponseID)
test r = 0

* logit regression (b is omitted)
logit correct p k r n , cluster(ResponseID)
test p = k
test p = r
test k = r
test r = n

* Expanded model discussed in appendix text
logit correct p k r n  z_harmrating white male age crimevictim conservative education, cluster(ResponseID)
test p = k
test p = r
test k = r
test r = n

* Experiment 5
* use: ShenEtAl_2011_Experiment5-PunishAfterSorting.dta

* Testing differences in standardized punishment ratings (z_punish) by mental state
reg z_punish p k r n b, nocons cluster(ResponseID)
test p = k
test k = r
test r = n
test n = b

* Table A4: Theme-by-theme testing of K / R differences
* Note: use the ShenEtAl_2011_HarmRatingByTheme.dta file in order to align original theme number and themes sorted by harm rating (as presented in the Appendix Tables and in the Figures)

* Data for the means reported in the table:
tabstat  punish if  k == 1, by(theme) s(mean)
tabstat  punish if  r == 1, by(theme) s(mean)

foreach x in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 {
reg z_punish p k r n if theme==`x', cluster(ResponseID)
test k = r
}

****** FOR BLAME RATING

* Experiment 1b: use: ShenEtAl_2011_Experiment1b-BlameNoInstructions.dta
* Testing differences in standardized blame ratings (z_blame) by mental state 
reg z_blame p k r n b, nocons cluster(ResponseID)
test p = k
test k = r
test r = n
test n = b

* Experiment 2b: use: ShenEtAl_2011_Experiment2b-BlameDefinitionsOnce.dta
* Testing differences in standardized blame ratings (z_blame) by mental state 
reg z_blame p k r n b, nocons cluster(ResponseID)
test p = k
test k = r
test r = n
test n = b

* Experiment 3b: use: ShenEtAl_2011_Experiment3b-BlameDefinitionsContinuous.dta
* Testing differences in standardized blame ratings (z_blame) by mental state 
reg z_blame p k r n b, nocons cluster(ResponseID)
test p = k
test k = r
test r = n
test n = b

* Experiment 5b [there is no experiment 4b]
* Use: ShenEtAl_2011_Experiment5b-BlameAfterSorting.dta
* Testing differences in standardized blame ratings (z_blame) by mental state 
reg z_blame p k r n b, nocons cluster(ResponseID)
test p = k
test k = r
test r = n
test n = b
